{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# OBJECTIVE:\n",
    "# Can we detect the error bars around a data point automatically?\n",
    "# (Vertical and Horizontal)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Generate a chart with error bars\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.linspace(0,10,10)\n",
    "y = np.sin(x)\n",
    "y_err = noise = np.random.normal(0,1,10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAD8CAYAAABjAo9vAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAADxRJREFUeJzt3X+IXNd5xvHnkeTEkRLqFq3jVLJ2DTUpwiRxGYxTQ3dru6C0oUpbWmxLadIYlkKTOiUQ7AraKUUQSAktNLRsEjcGrW2CY2PjunXkxBoTqN2MHDeVLKc1jteWa1cTQn5JIFf12z9mindX2vl1z9y5c+b7gUEzd+/e+14kPXPmzDnnOiIEAMjHpnEXAABIi2AHgMwQ7ACQGYIdADJDsANAZgh2AMgMwQ4AmSHYASAzhYPd9sW2/9X2v9k+bvsvUhQGABiOi848tW1J2yLip7YvkvRNSbdFxJMb/c727dtjbm6u0HkBYNocPXr0+xEx02u/LUVPFO13hp92Xl7UeXR9t5ibm1Oz2Sx6agCYKrZX+tkvSR+77c22n5F0StLhiHgqxXEBAINLEuwR8b8R8T5JOyVdY/uq9fvYXrTdtN1stVopTgsAuICko2Ii4oeSHpe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ru07Sb9p+Ue2ututtHxpvSSN3UtLJiPj/T2L3qR30ObtR0vciohUR/yPpfkm/POaayvLftt8lSZ0/T43iJJMU7N+SdKXtK2y/Re0vWx4ac00jZdtq972eiIjPjbueUYuIOyJiZ0TMqf33+42IyLolFxGvSXq5s/y1JN0g6dkxllSGlyRda3tr59/4Dcr8C+NVHpL0kc7zj0h6sMu+Qyt8z9OyRMQ52x+X9Kja36LfGRHHx1zWqF0n6cOS/t32M51tfxoRj4yxJqT3CUnLnQbLC5L+YMz1jFREPGX7PklPqz3y69vKcAaq7XskLUjabvuk2neX+4ykr9i+Ve0Vbn9vJOdm5ikA5GWSumIAAH0g2AEgMwQ7AGSGYAeAzBDsAJAZgh0AMkOwA0BmCHYAyMz/AbQ1u/Bg9UCyAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.errorbar(x, y, yerr=y_err, fmt=\"o\", capsize=10, ecolor=\"black\", color=\"red\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 432x288 with 0 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.savefig(\"images/errorbars.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
